let starBtn = document.querySelector(".starBtn");
let prizeCell = document.querySelectorAll(".drawBox box div:not(.starBtn)");
let index = 0;
let targetIndex = 87;
let timer;
let second = 200;
let isRun = true;

starBtn.addEventListener("click",function(){
    if (isRun) {
        isRun = false;
        run();
    }
})
function run (){
    setTimeout(function(){
        if (index){
            prizeCell[(index -1 ) % 8].classList.remove("active");
        }
        prizeCell[index % 8].classList.add("active");

        if (index < targetIndex){
            run();
        } else {
            isRun = true;
        }
        index++;

        if(second > 30 && index < 20){
            //加速
            second -= 20;
        }else if (index > 60){
            //减速
            second += 20;
        }
        
    },second)
}
